/* GUI CONVERTED from wowocc.p (converter v1.76) Wed May 22 11:24:17 2002 */
/* wowocc.p  -  WORK ORDER COMPONENT CHECK                                    */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.14 $                                                          */
/*V8:ConvertMode=Report                                                       */
/* REVISION: 1.0      LAST MODIFIED: 06/11/86   BY: EMB                       */
/* REVISION: 2.1      LAST MODIFIED: 09/10/87   BY: WUG *A94*                 */
/* REVISION: 4.0      LAST EDIT: 12/30/87       BY: WUG *A137*                */
/* REVISION: 5.0      LAST MODIFIED: 01/03/88   BY: MLB *B006*                */
/* REVISION: 7.0      LAST MODIFIED: 03/31/95   BY: jpm *F0PW*                */
/* REVISION: 7.0      LAST MODIFIED: 04/14/95   BY: ais *F0QK*                */
/* REVISION: 8.6      LAST MODIFIED: 10/31/97   BY: ays *K14Q*                */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.0      LAST MODIFIED: 02/11/99   BY: *M07Z* Mugdha Tambe       */
/* REVISION: 9.0      LAST MODIFIED: 03/13/99   BY: *M0BD* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KC* Mark Brown         */
/* REVISION: 9.1      LAST MODIFIED: 08/15/00   BY: *N0LB* Arul Victoria      */
/* Revision: 1.13       BY: Katie Hilbert       DATE: 04/01/01  ECO: *P008*   */
/* $Revision: 1.14 $    BY: Jean Miller         DATE: 05/16/02  ECO: *P05V*   */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "2+ "}

define new shared variable part like ps_comp.
define new shared variable nbr  like wod_nbr.
define new shared variable lot  like wod_lot.
define new shared variable short like mfc_logical label "Short Only" initial yes.
define new shared variable open_ref like wod_qty_req.
define new shared variable qty_iss like wod_qty_iss.
define new shared variable qty_oh like in_qty_oh.
define new shared variable qty_all like in_qty_all.
define new shared variable qavail as decimal  format "->>,>>9.9".
define new shared variable um like pt_um.
define new shared variable desc1 like pt_desc1.

define variable c-msg-string as character no-undo.
c-msg-string =  getTermLabel("ON_A_WORK_ORDER_BILL",20).


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   nbr
   lot
   part
   short
with frame a no-underline width 80 attr-space THREE-D /*GUI*/.

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

{wbrp01.i}
repeat:

   assign
      nbr = ""
      lot = ""
      part = "".

   display short with frame a.

   if c-application-mode <> 'web' then
   set
      nbr
      lot
      part
      short
   with frame a
   editing:

      if frame-field = "nbr" then do:
         /* FIND NEXT/PREVIOUS RECORD */
         {mfnp.i wod_det nbr wod_nbr nbr wod_nbr wod_nbrpart}
         if recno <> ? then do:
            display wod_nbr @ nbr with frame a.
            assign
               recno = ?
               nbr = wod_nbr.
         end.
      end.

      else if frame-field = "lot" then do:
         /* FIND NEXT/PREVIOUS RECORD */
         if input nbr <> "" then do:
            {mfnp01.i wod_det lot wod_lot "input nbr" wod_nbr wod_nbrpart}
         end.
         else do:
            {mfnp.i wod_det lot wod_lot lot wod_lot wod_det}
         end.
         if recno <> ? then do:
            display wod_lot @ lot with frame a.
            assign
               recno = ?
               lot = wod_lot.
         end.
      end.

      else if frame-field = "part" then do:
         /* FIND NEXT/PREVIOUS RECORD */
         {mfnp.i wod_det part wod_part part wod_part wod_part}
         if recno <> ? then do:
            display wod_part @ part with frame a.
            assign
               recno = ?
               part = wod_part.
         end.
      end.

      else do:
         status input.
         readkey.
         apply lastkey.
      end.

   end.

   {wbrp06.i &command = set &fields = "  nbr lot part short" &frm = "a"}

   if (c-application-mode <> 'web') or
      (c-application-mode = 'web' and
      (c-web-request begins 'data'))
   then do:

      if nbr <> "" and lot <> "" then
         find wo_mstr where wo_nbr = nbr and wo_lot = lot no-lock no-error.
      if nbr = "" and lot <> "" then
         find wo_mstr where wo_lot = lot no-lock no-error.
      if nbr <> "" and lot = "" then
         find first wo_mstr where wo_nbr = nbr no-lock no-error.
      if not available wo_mstr and (nbr <> "" or lot <> "") then do:
         {pxmsg.i &MSGNUM=510 &ERRORLEVEL=3} /*  WORK ORDER DOES NOT EXIST.*/
         if c-application-mode = 'web' then return.
         undo, retry.
      end.

      if part <> "" then do:
         find first wod_det where wod_part = part no-lock no-error.
         if not available wod_det then do:
            if can-find (pt_mstr where pt_part = part) then do:
               /* PART DOES NOT EXIST ON A WORK ORDER BILL */
               {pxmsg.i &MSGNUM=16 &ERRORLEVEL=3 &MSGARG1=c-msg-string}
            end.
            else do:
               /* PART DOES NOT EXIST */
               {pxmsg.i &MSGNUM=16 &ERRORLEVEL=3}
            end.

            if c-application-mode = 'web' then return.
            else next-prompt part       with frame a    .
            undo, retry.
         end.
      end.

   end.
   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "terminal" &printWidth = 80
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "no"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}

   {gprun.i ""wowocca.p""}
   {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

   {pxmsg.i &MSGNUM=8 &ERRORLEVEL=1}
end.

{wbrp04.i &frame-spec = a}
